service: send ubus notifications for event triggers
authorFelix Fietkau <[email protected]>
Thu, 2 Oct 2025 09:03:41 +0000 (11:03 +0200)
committerFelix Fietkau <[email protected]>
Thu, 2 Oct 2025 09:03:45 +0000 (11:03 +0200)
This makes it easier to use procd as distribution for system events

Signed-off-by: Felix Fietkau <[email protected]>
service/service.c

index f40a1f184f060aa5fd2fe21195698236c086c5c0..831f075a33f0f3387cde258ad6e36b8125bafcaf 100644 (file)
@@ -777,6 +777,11 @@ service_handle_event(struct ubus_context *ctx, struct ubus_object *obj,
        event = blobmsg_get_string(tb[EVENT_TYPE]);
        trigger_event(event, tb[EVENT_DATA]);
 
+       blob_buf_init(&b, 0);
+       blobmsg_add_string(&b, "type", event);
+       blobmsg_add_blob(&b, tb[EVENT_DATA]);
+       ubus_notify(ctx, &main_object, "event.trigger", b.head, -1);
+
        if (!strcmp(event, "config.change")) {
                struct blob_attr *tb2[__VALIDATE_MAX];